﻿using blackhouse.WebNemo.Business.Exceptions;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace blackhouse.WebNemo.Business.Groups {
    public class NewGroupRecord : GroupRecord {

        #region Constructors

        public NewGroupRecord(int groupId)
            : base(groupId, 0) {
            this.CheckAllowCreate();
        }

        public NewGroupRecord(int groupId, CultureInfo operatedLanguage)
            : base(groupId, 0, operatedLanguage) {
            this.CheckAllowCreate();
        }

        public NewGroupRecord(string groupName)
            : base(groupName, 0) {
            this.CheckAllowCreate();
        }

        public NewGroupRecord(string groupName, CultureInfo operatedLanguage)
            : base(groupName, 0, operatedLanguage) {
            this.CheckAllowCreate();
        }

        public NewGroupRecord(IGroup group)
            : base(group, null) {
            this.CheckAllowCreate();
        }

        public NewGroupRecord(IGroup group, CultureInfo operatedLanguage)
            : base(group, null, operatedLanguage) {
            this.CheckAllowCreate();
        }

        #endregion

        #region Methods

        private void CheckAllowCreate() {
            GroupType gt = this.GetGroup().Type;
            if (gt != GroupType.Table)
                throw new CreateRecordException(1001);
        }

        #endregion

    }
}
